// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

const db = cloud.database()
const _ = db.command
// 云函数入口函数
exports.main = async (event, context) => {
    if(event.type==1){
    return await db.collection('user').where({openid:event.openid}).update({
        data:{
            attachment: event.attachment
        }
    })
}
else if(event.type==2){
    return await db.collection('user2').where({openid:event.openid}).update({
        data:{
            attachment: event.attachment
        }
    })
}

else if(event.type==3){
    return await db.collection('user3').where({openid:event.openid}).update({
        data:{
            attachment: event.attachment
        }
    })
}
}